package com.web;

import com.MessageService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
@RequestMapping("/displayMessages")
public class DisplayMessagesController {
    @Resource
    private MessageService messageService;

    @RequestMapping("/displayMessages")
    public String displayMessages(Model model) {
        model.addAttribute("messages", messageService.getMessages());
        return "displayMessages";

    }
}
